'use strict'

$(function(){
    var searchurl = window.location.search
    // console.log(searchurl);
    var urlparame = searchurl.split('?')[1].split('=')[1]
    // console.log(urlparame);
    $.get(`http://localhost:3000/product/${urlparame}`,(res)=>{
            let html = `
                        <tr>
                            <td><p>Id</p></td>
                            <td>${res.id}</td>
                        </tr>
                        <tr>
                            <td><p>商品名称</p></td>
                            <td>${res.productName}</td>
                        </tr>
                        <tr>
                            <td><p>价格</p></td>
                            <td>${res.price}</td>
                        </tr>
                        <tr>
                            <td><p>库存</p></td>
                            <td>${res.stockNum}</td>
                        </tr>
                        <tr>
                            <td><p>供应商</p></td>
                            <td>${res.supplier}</td>
                        </tr>
                        <tr>
                            <td><p>备注</p></td>
                        </tr>
                    `
                    $('table').append(html)
        })
})

